const Joi = require('joi')

module.exports = {
  shopLogin: {
    body: {
      identityType: Joi.string()
        .regex(/[a-z]+$/)
        .required(),
      identifier: Joi.string().required(),
      password: Joi.string()
        .min(8)
        .max(16)
        .required()
    }
  },
  shopSignup: {
    body: {
      email: Joi.string()
        .email()
        .required(),
      confirmPass: Joi.string()
        .min(8)
        .max(16)
        .required(),
      password: Joi.string()
        .min(8)
        .max(16)
        .required()
    }
  },
  shopAddGoods: {
    body: {
      goods: Joi.array()
        .min(1)
        .items(
          Joi.object().keys({
            name: Joi.string().required(),
            price: Joi.string().required(),
            picurl: Joi.string().required(),
            description: Joi.string()
              .max(200)
              .required(),
            count: Joi.number().required(),
            sales: Joi.number().required(),
            detail: Joi.string().required()
          })
        )
    }
  },
  shopAddKinds: {
    body: {
      kinds: Joi.array().min(1)
      // kinds: Joi.array().items(
      //   Joi.object().keys({
      //     name: Joi.string().required()
      //   })
      // )
    }
  }
}
